<template>
  <!-- 完成随访详情 -->
  <section>
    <div style="border-bottom: 1px solid #eee; padding-bottom: 10px">
      <el-page-header @back="goBack" content="随访任务详情"></el-page-header>
    </div>
    <br />
    <div>
      <div style="margin-top: 20px">
        <h3 style="margin: 0">随访内容</h3>
        <hr />
        <table style="border: none; width: 100%">
          <tr style="height: 35px">
            <td>创建日期：{{ visitDetail.scheduleVisitTime }}</td>
            <td>创 建 人：{{ visitDetail.createName }}</td>
            <td>计划随访日期：{{ visitDetail.scheduleVisitTime }}</td>
            <td>计划执行人：{{ visitDetail.scheduleVisitUserName }}</td>
            <td>科室：{{ visitDetail.deptName }}</td>
            <td>主管医生：{{ visitDetail.doctorName }}</td>
          </tr>
          <tr style="height: 35px">
            <td colspan="4">随访类型：{{ visitDetail.visitType }}</td>
          </tr>
          <tr style="height: 35px">
            <td colspan="4">随访项目：{{ visitDetail.visitProject }}</td>
          </tr>
        </table>
      </div>
      <div style="margin-top: 20px">
        <h3 style="margin: 0">随访项目名称</h3>
        <hr />
        <table style="border: none; width: 100%">
          <tr style="height: 35px">
            <td>随访日期：{{ visitDetail.visitTime }}</td>
            <td>随访人员：{{ visitDetail.visitUserName }}</td>
            <td>随访方式：{{ visitDetail.visitWay }}</td>
          </tr>
        </table>
      </div>
      <div v-for="(item, index) in visitDetail.result" :key="index" style="margin-top: 10px">
        <h3 style="margin: 0">
          <label style="color: red" v-if="item.required">*</label>
          {{ index + 1 }}.{{ item.name }}
        </h3>
        <p style="line-height: 40px">{{ item.value }}</p>
      </div>
    </div>
  </section>
</template>
<script>
import enumArr from "./_enum/enum";
export default {
  data() {
    return {
      btnLoading: false,
      qxBtns: {},
      //随访任务详情
      visitDetail: {
        //创建人
        createName: "",
        //创建时间
        createTime: "",
        //科室名称
        deptName: "",
        //医生
        doctorName: "",
        recordId: "",
        //随访时间
        scheduleVisitTime: "",
        //随访项目
        visitProject: "",
        visitTime: "",
        visitUserName: "",
        //随访类型
        visitType: "",
        scheduleVisitUserName: "",
        cancelUserName: "",
        remark: "",
        cancelReason: "",
        visitContent: "",
        visitWay: "",
      },
      form: {
        recordId: "",
      },
      patientDetail: {},
    };
  },
  created() {
    this.form.recordId = this.jieMi(this.$route.query.id);
  },
  async mounted() {
    this.getVisitDetail();
  },
  methods: {
    //获取随访详情
    async getVisitDetail() {
      const { recordId } = this.form;
      if (recordId)
        await this.$api.getVisitResult({ recordId: recordId }).then((res) => {
          if (res.executed) {
            let d = res.dataBody;
            const {
              createName,
              createTime,
              deptName,
              recordId,
              doctorName,
              scheduleVisitTime,
              visitProject,
              visitType,
              result,
              visitWay,
              visitTime,
              visitUserName,
              visitUserId,
              id,
              scheduleVisitUserName,
            } = d;
            this.visitDetail = {
              //创建人
              createName: createName,
              //创建时间
              createTime: createTime,
              //科室名称
              deptName: deptName,
              //医生
              doctorName: doctorName,
              recordId: recordId,
              //随访时间
              scheduleVisitTime,
              //随访项目
              visitProject,
              //随访类型
              visitUserName: visitUserName,
              visitTime: visitTime,
              visitType: visitType,
              scheduleVisitUserName,
              result: JSON.parse(result),
              visitWay,
            };
          }
        });
    },
    goBack() {
      const th = this;
      th.$router.push({
        path: "visit",
      });
    },
  },
};
</script>